package com.taotao.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.taotao.common.pojo.EasyUIDataGridResult;
import com.taotao.common.utils.UniResult;
import com.taotao.pojo.TbContent;
import com.taotao.service.ContentService;

@Controller
@RequestMapping("/content")
public class ContentController {
	
	@Autowired
	private ContentService contentService;
	
	@ResponseBody
	@RequestMapping("/save")
	public UniResult insertContent(TbContent content) {
		UniResult result = contentService.insertContent(content);
		return result;
	}
	
	/**
	 * 内容分类管理--新增
	 * @param parentId
	 * @param name
	 * @return
	 */
	@RequestMapping("/category/create")
	@ResponseBody
	public UniResult createNode(Long parentId, String name) {
		UniResult result = contentService.insertCatgory(parentId, name);
		return result;
	}
	
	/**
	 * 内容管理分页查询
	 * @param page
	 * @param rows
	 * @return
	 */
	@ResponseBody
	@RequestMapping("/query/list")
	public EasyUIDataGridResult getItemList(Long categoryId,Integer page, Integer rows) {
		EasyUIDataGridResult result = contentService.getContentList(categoryId,page, rows);
		return result;
	}



}
